<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Zhou Wenying
  Date: 2023/2/6
  Time: 21:02
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>旧书交易平台</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/login.css">
    <link rel="stylesheet" href="/static/bootstrap/css/bootstrap.css">

</head>

<body id="login">

<div class="login">
    <h2> <strong><font face="仿宋" >旧书交易平台管理员登陆</font></strong></h2>
    <c:if test="${requestScope.msg != null}">
        <h3 style="color: red"><c:out value="${requestScope.msg}"></c:out></h3>
    </c:if>

    <form class="layui-form" method="post" target="_blank" action="/admin/doAdminLogin" >

        <div class="layui-form-item">
            <input value="admin" type="text" name="username"  id="username" placeholder="用户名" class="layui-input" required>
            <i class="layui-icon input-icon">&#xe66f;</i>
        </div>

        <div class="layui-form-item">
            <input value="admin" type="password" name="password" id="password" placeholder="密码"  class="layui-input" required>
            <i class="layui-icon input-icon">&#xe673;</i>
        </div>

        <div class="layui-form-item">
            <button style="width: 100%" class="layui-btn layui-btn-radius layui-btn-normal" lay-submit lay-filter="AdminLogin" >立即登录</button>
        </div>

        <br>
        <%--<div class="layui-row">
            <span class="layui-col-md8"><a style="color: #225592;" href="javascript:;"id="changePassword">找回密码</a></span>
            <span class="layui-col-md4"><a style="color: #225592;" href="/register">注册账号</a></span>
        </div>--%>
    </form>

</div>


<%--<div id="PopChangePassword" class="modal fade" tabindex="-1">
    <div class="modal-dialog">
        <div style="background-color: #fff;">
            <div style="padding: 15px;" class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">系统弹窗</h4>
            </div>
            <div class="modal-body">
                <div class="row clearfix">
                    <div class="form-group" style="padding: 15px">
                        <label class="col-sm-2 control-label">邮箱</label>
                        <div class="col-sm-10">
                            <input id="modalEmail" type="email" class="form-control"/>
                        </div>
                    </div>
                    <div class="form-group" style="padding: 15px">
                        <label class="col-sm-2 control-label">新密码</label>
                        <div class="col-sm-10">
                            <input id="modelPassword" type="password" class="form-control"/>
                        </div>
                    </div>
                    <div class="form-group" style="padding: 15px">
                        <label class="col-sm-2 control-label">验证码</label>
                        <div class="col-sm-7">
                            <input id="modelCode" type="text" class="form-control"/>
                        </div>
                        <div class="col-sm-3">
                            <button id="modelGetCode" type="button" class="btn btn-default btn-primary">获取验证码</button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button id="modelUpdatePassword" type="button" class="btn btn-default btn-success">修改</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>--%>

</body>

</html>
<script src="/static/js/jquery-3.6.1.min.js"></script>
<script src="/static/layui/layui.js"></script>
<script src="/static/layer/layer.js"></script>
<script src="/static/bootstrap/js/bootstrap.js"></script>
<script src="/static/js/bootstrap-pop.js"></script>

<%--
<script>
    $("#changePassword").click(function () {
        popShow("PopChangePassword");
    });

    //请求发送验证码
    $("#modelGetCode").click(function () {
        var email = $("#modalEmail").val();
        console.log(email+" :")
        if (email == null || email == undefined || email == ''){
            layer.msg('邮箱为空！');
            return;
        }
        $.ajax({
            url:"/getUpdatePasswordCode?email="+email,
            type:"get",
            dataType:"json",
            //data:json,
            contentType: false,
            success:function (json) {
                console.log(json);
                //var obj = JSON.parse(data);
                if (json.ret == 'true'){
                    console.log("true 111");
                    layer.msg(json.data);
                }else {
                    layer.msg(json.data);
                }
            },
            error:function (data) {

            }
        });
    });

    //做修改密码
    $("#modelUpdatePassword").click(function () {
        var email = $("#modalEmail").val();
        var password = $("#modelPassword").val();
        var code = $("#modelCode").val();
        if (email == null || email == undefined ||
            password == null || password == undefined ||
            code == null || code == undefined
        ){
            layer.msg('输入不能为空！');
            return;
        }

        var obj = {};
        obj.emscode = code;
        obj.password = password;
        obj.email = email;
        var json = JSON.stringify(obj);

        $.ajax({
            url:"/updatePassword",
            type:"post",
            dataType:"json",
            data:json,
            contentType: false,
            success:function (json) {
                console.log(json);
                //var obj = JSON.parse(data);
                if (json.ret == 'true'){
                    console.log("true 111");
                    layer.msg(json.data);
                }else {
                    layer.msg(json.data);
                }
            },
            error:function (data) {

            }
        });

    });

</script>--%>
